<script>
import config from "utils/config";
var Api = require("utils/api.js");
var util = require("utils/util.js");
var wxApi = require("utils/wxApi.js");
var wxRequest = require("utils/wxRequest.js");

var wss = config.getWss;
export default {
	data() {
		return {
			shouye:false,
			duanxintongzhi:5,
			tongjihome:{},
			uid:''
		}
    },
  onLaunch: function () {
	  var duixin = this;
	  //判断用户是否登录
	  
	  var userInfo = uni.getStorageSync('userInfo');
	  if (userInfo) {
	  	var member = uni.getStorageSync('member');
	  	var memberuid = uni.getStorageSync('memberuid');
	  	// 保留二次开发
	  	//this.getIm();
		//this.getTongjis(memberuid);
		
	  } else {
	  	//否则跳转到登录页面
	  	//uni.reLaunch({ url: '/pages/login/login'}) // 跳转到首页
	  }
	  

	  //console.log("显示123",duixin.duanxintongzhi);
    /*var logs = uni.getStorageSync('logs') || [];
    logs.unshift(Date.now());
    uni.setStorageSync('logs', logs);*/
	//判断用户是否登录
	/*var userInfo = uni.getStorageSync('userInfo');
	if (userInfo) {
		uni.reLaunch({ url: "/pages/wo/wo" }); // 跳转到会员页面
	} else {
		//否则跳转到登录页面
		uni.reLaunch({ path: '/pages/login/login' }) // 跳转到登录页面
	};*/
	/*var duixin = this;
	    let options = uni.getLaunchOptionsSync(); 
	    let url = options.path;
	    if(url == 'pages/index/index'){
	        duixin.shouye = true;
	    }
	console.log('shouye：',duixin.shouye);*/
  },
  onShow(){
	  var duixin = this;
	  //默认导航暗黑
	  var zhuti = this.$store.state.themeName;
	  this.globalData.zhuti(zhuti);
  },
	onThemeChange: function(options) {
	},
  globalData: {
	  themeChanged(theme) {
	    Vue.prototype.$u.currentTheme = theme;
	    themeListeners.forEach(listener => {
	      listener(theme);
	    });
	    uni.setStorage({
	      key: 'theme',
	      data: theme,
	    });
	  },
	  zhuti(zhuti) {
	    // 默认导航暗黑
	    if (zhuti === "dark") {  
			uni.setTabBarStyle({
				color: '#acacac',
				selectedColor: '#11d2b5',
				backgroundColor: '#101010',
				borderStyle: 'black'  
			});  
			uni.setTabBarItem({
				index: 0,
				text: '首页',
				iconPath: '/static/images/shouye.png',
				selectedIconPath: '/static/images/shouye2.png'
			})
			uni.setTabBarItem({
				index: 1,
				text: '圈子',
				iconPath: '/static/images/quan.png',
				selectedIconPath: '/static/images/quan2.png'
			})
			uni.setTabBarItem({
				index: 2,
				text: '',
				iconPath: '/static/images/fabu2.png',
				selectedIconPath: '/static/images/fabu2.png'
			})
			uni.setTabBarItem({
				index: 3,
				text: '消息',
				iconPath: '/static/images/duanxin0.png',
				selectedIconPath: '/static/images/duanxin1.png'
			})
			uni.setTabBarItem({
				index: 4,
				text: '我的',
				iconPath: '/static/images/wo.png',
				selectedIconPath: '/static/images/wo2.png'
			})
	    } else {  
	      // 白天  
	      uni.setTabBarStyle({  
			color: '#adadad',  
			selectedColor: '#000000',
			backgroundColor: '#ffffff',
			borderStyle: 'white'
	      });
		  uni.setTabBarItem({
		    index: 0,
		    text: '首页',
		    iconPath: '/static/images/shouye.png',
		    selectedIconPath: '/static/images/shouye2.png'
		  })
		  uni.setTabBarItem({
		    index: 1,
		    text: '圈子',
		    iconPath: '/static/images/quan.png',
		    selectedIconPath: '/static/images/quan2.png'
		  })
		  uni.setTabBarItem({
		  	index: 2,
		  	text: '',
		  	iconPath: '/static/images/fabu2.png',
		  	selectedIconPath: '/static/images/fabu2.png'
		  })
		  uni.setTabBarItem({
		    index: 3,
		    text: '消息',
		    iconPath: '/static/images/duanxin0.png',
		    selectedIconPath: '/static/images/duanxin1.png'
		  })
		  uni.setTabBarItem({
		    index: 4,
		    text: '我的',
		    iconPath: '/static/images/wo.png',
		    selectedIconPath: '/static/images/wo2.png'
		  })
	    }  
	  }
  },
  methods: {
	
  }
};
</script>
<style lang="scss">

/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */

@import "./app.css";
@import "./dui.css";
@import "/static/css/animate.min.css";
@import "@/uni_modules/uview-ui/index.scss";
@import '@/styles/index.scss';

</style>